package com.gc.gc.department.service.impl;

import com.gc.gc.department.repository.DepartmentDao;
import com.gc.gc.department.service.DepartmentService;
import com.gc.gc.mybatis.entity.PtDepartmentEntity;
import com.gc.gc.mybatis.entity.PtOrganEntity;
import com.gc.gc.mybatis.flexigrid.PadingRstType;
import com.gc.gc.mybatis.flexigrid.PagingBean;
import com.gc.gc.organ.entity.OrganSearchEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DepartmentServiceImpl implements DepartmentService {
    @Resource
    private DepartmentDao departmentDao;
    @Override
    public PadingRstType<PtDepartmentEntity> DepartmentList(PagingBean paging) {
        paging.deal(OrganSearchEntity.class);
        PagingBean newPa = new PagingBean();

        PadingRstType<PtDepartmentEntity> padingRstType = new PadingRstType<>();
        padingRstType.setPage(paging.getPage());
        List<PtDepartmentEntity> list = departmentDao.DepartmentList(paging);
        System.out.println(list);
        Integer total = departmentDao.queryDepartmentListTotal();
        padingRstType.setRawRecords(list);
        padingRstType.setTotal(total);
        padingRstType.putItems();
        return padingRstType;
    }
}
